<%@ page language="java" import="com.scalar.chiptrack.utils.StringUtils,
                                 java.util.Calendar,
                                 com.scalar.chiptrack.users.Functionality,
                                 java.util.LinkedHashMap,
                                 com.scalar.chiptrack.calendar.Period" %>


<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/chiptrack-tags.tld" prefix="chiptrack" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested"%>

<%@ page import="com.scalar.chiptrack.utils.ConfigManager"%>
<%@ page import="com.scalar.chiptrack.users.User" %>

<%String chipTracContext = "/" + ConfigManager.getChipTracContext();%>
<HTML>
<HEAD>
<TITLE>Scalarsoft - ChipTrac</TITLE>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<LINK href="<%=chipTracContext%>/jsp/includes/stylesheets/scalarsoft.css" type=text/css rel=stylesheet>

<script language="javascript" src="<%=chipTracContext%>/jsp/includes/scripts/validations.js"></script>
<script language="javascript" src="<%=chipTracContext%>/jsp/includes/scripts/functions.js"></script>
<script language = "javascript">

<%  LinkedHashMap financialYears = (LinkedHashMap)request.getAttribute("YearsMap");

    if(financialYears != null)
    {
        int listSize = financialYears.size();
        java.util.Iterator iterator = financialYears.keySet().iterator();
        Period periods[] = new Period[listSize];
        %>
            var years     = new Array(<%=financialYears.size()%>);
            var startDate = new Array(<%=financialYears.size()%>);
            var endDate   = new Array(<%=financialYears.size()%>);
        <%
        for( int aa = 0; aa < listSize ; aa++)
        {
           Object key = iterator.next();
           if( financialYears.get(key)!= null )
            {
                if(financialYears.containsKey(key))
                {
                    periods[aa] = (Period)financialYears.get(key);
                    %>
                        years[<%=aa%>] = '<%=key%>';
                        startDate[<%=aa%>] = '<%=periods[aa].getStartDate()%>';
                        endDate[<%=aa%>] = '<%=periods[aa].getEndDate()%>';
                    <%
               }
           }
       } //for
   }
%>

var dateElement = "";
var errors = "";
var tble ;
var tr   ;
var tbd  ;
var day_array   = new Array(31,28,31,30,31,30,31,31,30,31,30,31);
function divideIntervals()
{
    errors          = "";
    selected_year = document.financialPeriodsForm['year'] ;
    new_year = document.financialPeriodsForm['newYear'] ;

	var from_dt     = document.financialPeriodsForm['firstDay'];
	var to_dt       = document.financialPeriodsForm['lastDay'];
	var intervals   = document.financialPeriodsForm['numberOfPeriods'].value;
	var days        = 0;

	var pa = document.getElementById("errors1");
    pa.innerHTML = '';

    if( selected_year.value != "-2" && selected_year.value < new Date().getYear()  )
    {
        errors = "<li>Please Select the New Year";
    }
    else if( selected_year.value == "-2" && new_year.value == '' )
    {
        errors = "<li>Please Enter the New Year";
        new_year.select();
        new_year.focus();
    }
    else if( selected_year.value == "-2" && checkYear() == false)
    {
        errors = errors+"<br>"+errMsg;
        document.financialPeriodsForm['newYear'].select();
        document.financialPeriodsForm['newYear'].focus();
    }
    else if( chkDate(from_dt.value,"First Day","Y") == false)
    {
        errors = errors+"<br>"+errMsg;
        from_dt.select();
        from_dt.focus();
    }
    else if( chkDate(to_dt.value,"Last Day","Y") == false)
    {
        errors = errors+"<br>"+errMsg;
        to_dt.select();
        to_dt.focus();
    }
    else if ( ValidateLeadDate1( from_dt.value, to_dt.value,"","Y" ) == false )
	{
		errors = '<br>'+ "<li>First Day should be less than Last Day";
    }
    else if( chkDate(from_dt.value,"First Day","Y") == true && chkDate(to_dt.value,"Last Day","Y") == true && checkDates() == false)
    {
        errors = errors+"<br>"+errMsg;
        document.financialPeriodsForm['firstDay'].select();
        document.financialPeriodsForm['firstDay'].focus();
    }
    if( errors != '')
    {
        var pa = document.getElementById("errors1");
	    pa.innerHTML = errors;
        return;
    }
    else
    {
        document.financialPeriodsForm.action.value="calculate";
        document.financialPeriodsForm.submit();
    }
}
function checkYear()
{
    for( var i = 0 ; i < years.length; i++ )
    {
        if ( years [ i ] == document.financialPeriodsForm['newYear'].value )
        {
            errMsg="<li> Quarters already exists for this year";
            return false;
        }
    }
    return true;
}
function checkDates()
{
    var from_dt     = document.financialPeriodsForm['firstDay'];
	var to_dt       = document.financialPeriodsForm['lastDay'];

    from_dt.value = formatDateAsMMDDYYYY( from_dt.value );
    to_dt.value   = formatDateAsMMDDYYYY( to_dt.value );

    if( document.financialPeriodsForm.year.value == "-2" )
    {
        temp_year = document.financialPeriodsForm.newYear.value;
    }
    else
    {
        temp_year = document.financialPeriodsForm.year.value;
    }
    from_year = (from_dt.value).split("/");
    to_year   = (to_dt.value).split("/");
    if( !( from_year[2] <= temp_year && temp_year <= to_year[2] ) )
    {
        errMsg="<li> Year out of range from First Day to Last Day";
        return false;
    }
    for( var i = 0 ; i < years.length; i++ )
    {
        if ( years[i] != document.financialPeriodsForm.year.value )
        {
            if ( !( ValidateLeadDate1( to_dt.value, startDate[i],"","Y" )  ||  ValidateLeadDate1( endDate[i], from_dt.value,"","Y" ) ) )
            {
                errMsg="<li> Dates should not over lap with another Year ";
                return false;
            }
        }
    }
    return true;
}
function checkPeriods()
{
    var from_dt     = document.financialPeriodsForm['firstDay'];
	var to_dt       = document.financialPeriodsForm['lastDay'];
    var intervals   = document.financialPeriodsForm['numberOfPeriods'].value;
    var from_dt1    = document.financialPeriodsForm['fromdt'];
    var to_dt1      = document.financialPeriodsForm['todt'];

    for( var i = 0 ; i < intervals; i++ )
    {
        if ( chkDate(from_dt1[i].value,"Start Date","Y") == false || chkDate(to_dt1[i].value,"End Date","Y") == false )
        {
            return false;
        }
        from_dt1[i].value = formatDateAsMMDDYYYY( from_dt1[i].value );
        to_dt1[i].value   = formatDateAsMMDDYYYY( to_dt1[i].value );
    }
    for( var i = 0 ; i < intervals - 1   ; i++ )
    {
        for ( var j = i + 1 ; j < intervals ; j++ )
        {
            if ( ! ( ValidateLeadDate1( to_dt1[j].value, from_dt1[i].value,"","Y" ) || ValidateLeadDate1( to_dt1[i].value, from_dt1[j].value,"","Y" ) )  )
            {
                errMsg = "<li>Periods should not overlap";
                return false;
            }
        }
    }
    for( var i = 0 ; i < intervals  ; i++ )
    {
        if ( ! ( ValidateLeadDate1( from_dt1[i].value, to_dt1[i].value,"","Y" )  )  )
        {
            errMsg = "<li>End Date should be greater than Start Date";
            to_dt1[i].select();
            to_dt1[i].focus();
            return false;
        }
    }
    return true;
}
function changeDay(element)
{
    errors = "";
	var i;
    var intervals   = document.financialPeriodsForm['numberOfPeriods'].value;
    if( chkDate(element.value,"End Date","Y") == false)
    {
        errors = errors + "<br>"+errMsg;
        element.select();
        element.focus();
    }
    else
    {
        for(  i = 0 ; i < intervals ; i++ )
        {
            if ( element.value == document.financialPeriodsForm.todt[i].value )
            break;
        }
        array1=(element.value).split("/");
        if( array1[1] <=  62 && i < ( intervals - 1 ))
        {
            array2=(document.financialPeriodsForm.fromdt[i+1].value).split("/");
            array2[0] = array1[0];
            array2[1] = 1 + eval(array1[1]);

            if( day_array[eval(array2[0]) - 1] < array2[1] )
            {
                array2[1] = eval(array2[1]) - eval(day_array[eval(array2[0]) - 1]);
                array2[0] = 1 + eval(array2[0]);
                if( array2[0] > 12 )
                {
                    array2[0] = 1;
                    array2[2]++;
                }
            }
            document.financialPeriodsForm.todt[i].value     = formatDateAsMMDDYYYY( array1[0]+"/"+array1[1]+"/"+array1[2] );
            document.financialPeriodsForm.fromdt[i+1].value = formatDateAsMMDDYYYY( array2[0]+"/"+array2[1]+"/"+array2[2] );
        }
    }
    //document.getElementById("errors1").innerHTML = errors;
    return true;
}
function openCalendar(dateValue)
{
    dateElement = dateValue;

    newWindow = window.open('<%=chipTracContext%>/jsp/includes/calendar.html','calenderPopup','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=180,height=440,resizable=no');
    newWindow.moveTo(550,180);
    newWindow.focus();
}
function assignDate(passedValue)
{
    dateElement.value=passedValue;
    window.focus();
}
function restrictCharecters()
{
    if( event.keyCode < 48 || event.keyCode > 57 )
    {
        event.keyCode = false;
    }
}
function checkDate()
{
    if( event.keyCode < 47 || event.keyCode > 57 )
    {
        event.keyCode = false;
    }
}
function loadQuarters()
{
    year = document.financialPeriodsForm.year.value;
    document.financialPeriodsForm.action.value = "loadPeriods";
    document.financialPeriodsForm.submit();
}
function save()
{
    var pa = document.getElementById("errors1");
    pa.innerHTML = "";
    errors = "";
    selected_year  = document.financialPeriodsForm.year;
    var intervals  = document.financialPeriodsForm['numberOfPeriods'].value;
    var quarter    = document.financialPeriodsForm['quarterID'];
    var from_dt    = document.financialPeriodsForm['firstDay'];
	var to_dt      = document.financialPeriodsForm['lastDay'];
	var wwStartDate= document.financialPeriodsForm['wwStartDate'];
    var startDate  = document.financialPeriodsForm['fromdt'];
	var endDate    = document.financialPeriodsForm['todt'];

    var old_year   = document.financialPeriodsForm['year'];
    var new_year   = document.financialPeriodsForm['newYear'];

    if( selected_year.value != "-2" && selected_year.value < new Date().getYear()  )
    {
        errors = "<li>Cannot modify previous Years";
    }
    else if( old_year.value == "-2" && new_year.value == '' )
    {
        errors = "<li>Please Enter the New Year";
        new_year.select();
        new_year.focus();
    }
    else if( old_year.value == "-2" && new_year.value != '' && !isInteger( new_year.value ) )
    {
        errors = '<br>'+ "<li>Please enter a valid Year";
        new_year.select();
        new_year.focus();
    }
    else if( old_year.value == "-2" && new_year.value != '' && checkYear() == false)
    {
        errors = errors+"<br>"+errMsg;
        new_year.select();
        new_year.focus();
    }
    else if( chkDate(from_dt.value,"First Day","Y") == false)
    {
        errors = errors+"<br>"+errMsg;
        from_dt.select();
        from_dt.focus();
    }
    else if( chkDate(to_dt.value,"Last Day","Y") == false)
    {
        errors = errors+"<br>"+errMsg;
        to_dt.select();
        to_dt.focus();
    }
    else if( chkDate(wwStartDate.value,"WorkWeek Start Date","Y") == false)
    {
        errors = errors+"<br>"+errMsg;
        wwStartDate.select();
        wwStartDate.focus();
    }
    else if( chkDate(from_dt.value,"First Day","Y") == true && chkDate(to_dt.value,"Last Day","Y") == true && checkDates() == false)
    {
        errors = errors+"<br>"+errMsg;
        document.financialPeriodsForm['firstDay'].select();
        document.financialPeriodsForm['firstDay'].focus();
    }
    else if( startDate == null )
    {
        errors = errors+"<br><li> Please Calculate the Periods before Save"
    }
    else
    {
        for ( var i = 0 ; i < intervals ; i++ )
        {
            if ( quarter[i].value == '' )
            {
                quarter[i].select();
                errors = errors + "<br><li> Period name cannot be blank"
                break;
            }
        }
        for( var i = 0; i < ( intervals - 1 ); i++ )
        {
            for ( var j = i+1 ; j < intervals ; j++ )
            {
                if( trim(quarter[i].value) == trim(quarter[j].value) &&  quarter[i].value != '')
                {
                   errors = errors+"<br><li> Period names cannot be duplicated";
                   i = i + intervals;
                   j = i;
                }
            }
        }
        if ( checkPeriods() == false )
        {
            errors = errors +"<br>"+errMsg;
        }
        else if ( formatDateAsMMDDYYYY(from_dt.value) != startDate[0].value || to_dt.value != endDate[intervals - 1 ].value )
        {
            errors = errors + "<li> The first period start date should be Year Start date and Final period end date should be Year End date";
        }
    }
    if( errors != '' )
    {
	    pa.innerHTML = errors;
        return;
    }
    else
    {

        document.financialPeriodsForm.action.value = "save";
        document.financialPeriodsForm.submit();
    }
}

function checkLeapYear( N )
{
    if ( ( N%4==0 && N%100 !=0 ) || ( N%400==0 ) )
    {
        day_array[1] = 29;
    }
    else
        day_array[1] = 28;
}
function showErrorReportPage()
{
    newWindow = window.open ('<%=chipTracContext%>/reportProblem.do','reportProblem','channelmode=no,directories=no,toolbar=no,menubar=no,personalbar=no,status=no,scrollbars=no,width=750,height=400,resizable=no');
    newWindow.focus();
}

function getWorkWeek()
{
    var pa = document.getElementById("errors2");
    pa.innerHTML = "";
    errors = "";
    workWeek = document.financialPeriodsForm['workWeekDate'];
    if( chkDate( workWeek.value, "Work Week Date", "Y" ) == false)
    {
        errors = errors + "<br>" + errMsg;
        workWeek.select();
        workWeek.focus();
    }
    if( errors != '' )
    {
	    pa.innerHTML = errors;
        return;
    }
    else
    {
        document.financialPeriodsForm.action.value = "workWeek";
        document.financialPeriodsForm.submit();
    }
}
</script>
</HEAD>
<BODY bgColor=#ffffff leftMargin=0 topMargin=0 marginheight="0" marginwidth="0">

<!-- Top Header Start-->
<%@ include file="/jsp/includes/header.jsp" %>
<!-- Top Header End-->

<TABLE cellSpacing=0 cellPadding=0 width="100%" border="0">
  <TBODY>
  <TR>
	<td width='180' valign='top' background='<%=chipTracContext%>/jsp/includes/images/left_red_bg.gif'>

<!-- Side Navigation start -->
<%@ include file="/jsp/admin/admin_menu.jsp" %>
<!-- end of the side navigations -->
<TD bgcolor="#ffffff">
<IMG height=9 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=8></TD>
<TD bgcolor="#ffffff"><IMG height=480 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=2></TD>
<TD valign="top" width="100%" align="left">
<IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/clear.gif" width=500 border=0>
<BR>
<chiptrack:permission functionality='<%=Functionality.CONFIG_SETUP%>'
    action='<%=User.USER_ACTION_MODIFY%>' styleClass="NArialL" >
</chiptrack:permission>

<!-- from here your body starts -->
<html:form name="financialPeriodsForm" action="/calendar" method="post" type="com.scalar.chiptrack.calendar.forms.CalendarForm" scope="session">

<TABLE BORDER="0" WIDTH="100%">
<TR>
        <TD WIDTH="100%" ALIGN="CENTER" CLASS="NArialW" >
            <P ALIGN="CENTER">Company Calendar
        </TD>
</TR>
<TR>

<TD width="100%">
    <TABLE BORDER="0" WIDTH="100%">
    <tr><td colspan=7><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
    <tr><td colspan="7" align="left" class="NArialL"><font id ="errors" styleClass="NArialL" color='FF0000'></font></td></tr>
    <TR>
        <td width="10%"></td>
        <TD colspan=6 ><chiptrack:info styleClass="NArialL" /></TD>
    </TR>
    <TR>
            <td width="10%"></td>
            <TD colspan=6><chiptrack:errors styleClass="NArialL" /></TD>
    </TR>
    <TR>
            <td width="10%"></td>
            <TD colspan=6 align="left" class='NArialL'><FONT id="errors1" styleClass="NArialL" color='FF0000'></FONT></FONT>
            </TD>
    </TR>
    <tr><td colspan=7><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=10></td></tr>
	<tr class="NArialL" height="32">
      <td width="10%">&nbsp;</td>
      <td width="15%"><font class="NArialL">Year :  <font color = "red"><B>*</B></FONT></font></td>
      <td width="15%"><font class="NArialL">
       <html:select property="year" styleClass="txfield" onchange="javascript:loadQuarters()">
            <html:option value="" >-- Select -- </html:option>
            <html:option value="-2" >-- New Year --</html:option>
            <html:options collection="FinancialYears"  property="value" labelProperty="label"/>
        </html:select>
	  </td>
      <td width="4%">&nbsp;</td>
      <logic:equal name="showYear" value="TRUE">
          <td width="15%">New Year : &nbsp;<font id="NewYearLabel">&nbsp;&nbsp;</font> </td>
          <td width="15%"><font class="NArialL">
                <html:text property="newYear" size="5" maxlength="4" styleClass="txfield"  onkeypress="javascript:restrictCharecters()"  />
          </font>
      </logic:equal>


      </td>
	  <td width="7%">&nbsp;</td>
    </tr>
	<tr height="32">
     <td width="10%">&nbsp;</td>
     <td width="15%" class="NArialL">First Day: &nbsp;<font color = "red"><B>*</B></FONT> <BR>( MM/DD/YYYY )</td>
     <td width="15%"><font class="NArialL" nowrap>
        <html:text property="firstDay" size="13" styleClass="txfield" maxlength="10" onkeypress="javascript:checkDate()" /></font>
     <a href="javascript:openCalendar(document.financialPeriodsForm.firstDay )"><img onMouseOver="window.status='Click here to select date';return true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>
     </td>
     <td width="4%">&nbsp;</td>
     <td width="15%" class="NArialL">Last Day : &nbsp;<font color = "red"><B>*</B></FONT>
     <BR>( MM/DD/YYYY )</td>
     <td width="15%"><font class="NArialL" nowrap>
        <html:text property="lastDay" size="13" styleClass="txfield" maxlength="10" onkeypress="javascript:checkDate()" /></font>
        <a href="javascript:openCalendar(document.financialPeriodsForm.lastDay )"><img onMouseOver="window.status='Click here to select date';return true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>
     </td>
     <td width="7%">&nbsp;</td>
    </tr>

	<tr height="32">
     <td width="10%" height="30">&nbsp;</td>
     <td width="15%" NoWRAP><font class="NArialL">Number of Periods: &nbsp;<font color = "red"><B>*</B></FONT></font></td>
     <td width="15%"><font class="NArialL">
        <html:text property="numberOfPeriods" size="4" maxlength="3" styleClass="txfield" value="4" readonly="true" /></font></td>
     <td width="4%">&nbsp;</td>
     <td width="15%" class="NArialL">Work Week Start Date : &nbsp;<font color = "red"><B>*</B></FONT></td>
     <td width="15%"><font class="NArialL" nowrap>
        <html:text property="wwStartDate" size="13" styleClass="txfield" maxlength="10" onkeypress="javascript:checkDate()" /></font>
        <a href="javascript:openCalendar(document.financialPeriodsForm.wwStartDate )"><img onMouseOver="window.status='Click here to select date';return true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>
     </td>
     <td width="7%">&nbsp;</td>
    </tr>
<tr>
</tr>
</table>


<TABLE id="tble" BORDER="0" WIDTH="75%" align="center">
<tr><td colspan=8><img src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" height=20></td></tr>
<tr><td colspan='12' align="left"><FONT id="font1"></FONT></TD></TR>
<logic:equal name="showPeriods" value="TRUE">

<tr>
     <td width="6%" bgcolor="#993333"><P ALIGN="CENTER"><B><SPAN STYLE="Font-Size : 11px"><FONT COLOR="white">Period</FONT></SPAN></B></td>
     <td width="15%" bgcolor="#993333"><P ALIGN="CENTER"><B><SPAN STYLE="Font-Size : 11px"><FONT COLOR="white">Period Name</FONT></SPAN></B></td>
     <td width="15%" bgcolor="#993333"><P ALIGN="CENTER"><B><SPAN STYLE="Font-Size : 11px"><FONT COLOR="white">Start Date</FONT></SPAN></B></td>
     <td width="15%" bgcolor="#993333"><P ALIGN="CENTER"><B><SPAN STYLE="Font-Size : 11px"><FONT COLOR="white">End Date</FONT></SPAN></B></td>

</tr>
<% java.util.ArrayList list = (java.util.ArrayList)request.getAttribute("PeriodList");
   for ( int i = 0 ; i < list.size(); i++ ){
        Period period = (Period)list.get(i);
    %>
<TR <% if( i % 2==0){%>
 BGCOLOR="#DEE1E2"
    <%} else{ %> BGCOLOR="#DEE1E2"  <% } %> class="NArialL">
     <td width="6%"  align="center"><font class="NArialL" >&nbsp;&nbsp;<%=i+1%> </font>
        <input type="hidden" name="quarterNo" value="<%=i+1%>">
     </td>
     <td width="15%" align="center"><font class="NArialL"><input type="text" name="quarterID" size="22" Class="txfield" maxlength="20" value="<%=period.getQuarter()%>"/></font></a></td>
     <td width="15%"  align="center" nowrap ><font class="NArialL" ><input type="text" name="fromdt" size="13" Class="txfield" maxlength="10" value="<%=period.getStartDate()%>" onkeypress="javascript:checkDate()" /></font>&nbsp;<a href="javascript:openCalendar(document.financialPeriodsForm.fromdt[<%=i%>])"><img onMouseOver="window.status='Click here to select date';return true" onmouseout="window.status='';return true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a></td>
     <td width="15%"  align="center" nowrap ><font class="NArialL" ><input type="text" name="todt" size="13" Class="txfield" maxlength="10" onchange="javascript:changeDay(this)" value="<%=period.getEndDate()%>" onkeypress="javascript:checkDate()" /></font>&nbsp;<a href="javascript:openCalendar(document.financialPeriodsForm.todt[<%=i%>])"><img onMouseOver="window.status='Click here to select date';return true" onmouseout="window.status='';return true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a></td>

    <%}%>
</logic:equal>
</table>
<TABLE BORDER="0" WIDTH="100%">
<tr></tr>
<tr></tr>
<tr></tr>
<tr>
<td align="right">

<chiptrack:restrictedLink functionality='<%=Functionality.CONFIG_SETUP%>' action='<%=User.USER_ACTION_MODIFY%>' href="javascript:divideIntervals();" onmouseover="window.status='Click here to Calculate Intervals';return true" onmouseout="window.status='';return true">
<img border="0" src="<%=chipTracContext%>/jsp/includes/images/calculate.gif" width="65" height="17" title="Click here to Calculate Intervals"></img>
</chiptrack:restrictedLink>

&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</td>
</tr>
<tr>
    <td colspan=7 align=center>
        <chiptrack:restrictedLink functionality="<%=Functionality.CONFIG_SETUP%>" action="<%=User.USER_ACTION_MODIFY%>"
                 href="javascript:javascript:save()" onmouseover="window.status='Click to Save Financial Periods';return true" onmouseout="window.status='';return true">
        <IMG SRC="<%=chipTracContext%>/jsp/includes/images/save.gif" WIDTH="53" HEIGHT="17" ALIGN="BOTTOM" BORDER="0" title="Click here to Save Financial Periods">
    </chiptrack:restrictedLink>
      &nbsp;
      <a href="javascript:document.financialPeriodsForm.reset();"><img src="<%=chipTracContext%>/jsp/includes/images/reset.gif" border='0' onmouseover="window.status='Click  to Reset';return true" onmouseout="window.status='';return true" title="Click here to Reset"></a></td>
</tr>
  </table>
  </td>
  </tr>
<tr><td>&nbsp;</td></tr>
<tr>
    <td>
        <table border="0" width="75%" align = center>
            <TR>
            <TD colspan="2" class='NArialL'><FONT id="errors2" styleClass="NArialL" color='FF0000'>&nbsp;</FONT></FONT>
            </TD>
            </TR>
            <tr>
                <td width="60%" >
                <font class="NArialL">Enter Date For Work Week:</font>
                <font class="NArialL"><html:text property="workWeekDate" size="13" styleClass="txfield" maxlength="10" onkeypress="javascript:checkDate()" /></font>
                <a href="javascript:openCalendar(document.financialPeriodsForm.workWeekDate )"><img onMouseOver="window.status='Click here to select date';return true" border="0" align='center' src="<%=chipTracContext%>/jsp/includes/images/date_selector.gif" height=20 width=20></a>
                </td>
                <td width="40%">
                    <a href="javascript:getWorkWeek()">
                        <IMG SRC="<%=chipTracContext%>/jsp/includes/images/submit.gif" WIDTH="53" HEIGHT="17" ALIGN="BOTTOM" BORDER="0" onmouseover="window.status='Click here to get Work Week';return true" onmouseout="window.status='';return true" title="Click here to get Work Week">
                    </a>
                </td>
            </tr>
            </tr><tr>
            <logic:equal name="showWorkWeek" value="TRUE">
            <tr>
                <td><font class="NArialL"><bean:write name="financialPeriodsForm" property="workWeek" filter="false"/><font></td>
            </tr>
            </logic:equal>
        </table>
    </td>
</tr>

  </table>
<!-- till here -->
<BR><BR><BR></TD>
 <TD bgcolor="#ffffff"><IMG height=1 src="<%=chipTracContext%>/jsp/includes/images/spacer.gif" width=1></TD>
</TR>
</TABLE>

<!-- Footer starts here -->
<%@ include file="/jsp/includes/footer.jsp" %>
<!-- footer end here -->
<input type="hidden" name="action" value="">
</html:form>
</BODY>
</HTML>
